<!--
+----------------------------------------------------------------------
| 友得云客  - 开启房产营销新纪元
+----------------------------------------------------------------------
| Copyright (c) 2019~2023 优得（西安）信息科技有限公司版权所有
+----------------------------------------------------------------------
| Licensed 友得云客不是自由软件 未经允许不可移除相关版权
+----------------------------------------------------------------------
| Author: www.youdeyunke.com
+----------------------------------------------------------------------
-->
<template>
    <div class="album-picker" v-cloak>
        <el-form-item label="选择分类">
            <el-select v-model="albumId" placeholder="请选择房源分类" size="mini">
                <el-option filterable v-for="item in albums" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
            </el-select>
        </el-form-item>
    </div>
</template>

<script>

import { getAlbumList } from '@/api/post'

export default {
    data () {
        return {
            albums: [],
            loading: false,
        };
    },
    props: {
        value: { type: Number, default: null },
    },

    mounted: function () {
        this.loadAlbums()
    },


    computed: {
        albumId: {
            get () {
                return this.value
            },
            set (v) {
                this.$emit('input', v)
            },
        }
    },

    methods: {

        loadAlbums: function () {
            this.loading = true
            getAlbumList().then((res) => {
                this.albums = res.data
                this.loading = false
            })

        },
    }
};
</script>

<style scoped></style>